/*
 * @Author: fxg1997
 * @Date: 2020-06-30 15:44:20
 * @LastEditTime: 2021-03-26 10:09:34
 * @LastEditors: wangwangwang
 * @Description: In User Settings Edit
 * @FilePath: \icps_baseWeb\src\main.js
 */
import Vue from 'vue'
import App from './App.vue'
import VueAMap from 'vue-amap'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import '@/styles/index.scss'
import "./registerServiceWorker";
/*引入svg图*/
import Icon from 'vue2-svg-icon/Icon.vue'
Vue.component('icon', Icon)
import './permission'
import { getButtonList } from "@/utils/auth";
import '@/utils/directives.js';
// import 'babel-polyfill';
Object.defineProperty(Vue.prototype, '$ButtonList', { value: getButtonList })

import * as filters from './filters'
//过滤器
Object.keys(filters).forEach(key => {
  Vue.filter(key, filters[key])
})
//组件内监听打印{{log(JSON.parse(JSON.stringify(scope.row)))}}
Vue.prototype.log = window.console.log


//同一路由报错问题
import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error => error)
}
//时间方法
Date.prototype.Format = function (fmt) { //author: meizz   
  var o = {
    "M+": this.getMonth() + 1,                 //月份   
    "d+": this.getDate(),                    //日   
    "h+": this.getHours(),                   //小时   
    "m+": this.getMinutes(),                 //分   
    "s+": this.getSeconds(),                 //秒   
    "q+": Math.floor((this.getMonth() + 3) / 3), //季度   
    "S": this.getMilliseconds()             //毫秒   
  };
  if (/(y+)/.test(fmt))
    fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  for (var k in o)
    if (new RegExp("(" + k + ")").test(fmt))
      fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  return fmt;
};

Vue.use(VueAMap);

/*引入全局函数*/
import common from './common/common.js'
Vue.use(common);
import regExp from './common/RegExpExprot.js'
Vue.prototype.$regExp = regExp

/**打印 */
import print from 'print-js'
Vue.prototype.$print = print

Vue.config.productionTip = false
Vue.use(ElementUI, {
  size: 'small',
  zIndex: 3000
});
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
